The net/http package provides everything needed for a production-ready HTTP server. Use a custom http.ServeMux and configure server timeouts to prevent slow-client attacks.
Always set ReadTimeout, WriteTimeout, IdleTimeout — defaults are zero (no timeout = DoS vulnerability)
Go 1.22 adds method and path parameter support to ServeMux: GET /users/{id}
Use http.NewServeMux() not the default mux to avoid global state in tests
Wrap with middleware for logging, auth, and panic recovery before registering with the server
For HTTP/2 and TLS: use srv.ListenAndServeTLS(certFile, keyFile)